package com.llmm.controller;

import com.llmm.bean.UserAction;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 用户控制层
 * 在浏览器输入 http://localhost:8002/swagger-ui.html 即可查看
 */

@Api(value = "用户操作日志",tags = "用户操作日志")
@RestController
@RequestMapping("swagger")
public class UserController {

    @ApiOperation("用户操作日志新增")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userAction", value = "用户操作日志", required = true, dataType = "UserAction", paramType = "body")
    })
    @PostMapping("/insert")
    public String insertAction(@RequestBody UserAction userAction){
        return "测试插入成功";
    }

    @ApiOperation("查询所有日志操作")
    @GetMapping(value = "/findAll")
    public List<UserAction> queryAllApps() {
        ArrayList<UserAction> list = new ArrayList<>();
        UserAction userAction1 = new UserAction();
        UserAction userAction2 = new UserAction();
        list.add(userAction1);
        list.add(userAction2);
        return list;
    }

    @ApiOperation("通过账户和请求地址查询用户操作")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "account", value = "用户账户", required = true, dataType = "String", paramType = "path"),
            @ApiImplicitParam(name = "serviceURI", value = "请求地址", required = true, dataType = "String", paramType = "path")
            })
    @GetMapping(value = "/queryById/{account}/{serviceURI}")
    public UserAction queryById(@PathVariable String account, @PathVariable String serviceURI) {
        UserAction userAction = new UserAction();
        return userAction;
    }



}
